<template>
  <div>
    <DialogParamEdit v-model="oBus.isParamEditShown" :target="oBus.paramEditTarget" />
    <DialogLocalEdit v-model="oBus.isLocalEditShown" :target="oBus.localEditTarget" />
  </div>
</template>

<script setup lang="ts">
import { oBus } from '~/models/graph/editorbus';
import { saveOProject } from '~/models/Project';

const counter = ref(0)


function onGlobalKeyDown(ev: KeyboardEvent) {
  if ((ev.ctrlKey || ev.metaKey) && ev.code === 'KeyS') {
    try {
      saveOProject()
    }
    catch (err) {
      console.error(err)
    }
    ev.preventDefault()
  }
  // console.log(ev);
}
onMounted(() => window.addEventListener('keydown', onGlobalKeyDown))
onUnmounted(() => window.removeEventListener('keydown', onGlobalKeyDown))
</script>